#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int MAXN=1e7+7;
ll mu[MAXN];
ll prime[MAXN],p_cnt;
bool is_prime[MAXN];
void Mubi() {
	memset(is_prime, 1, sizeof(is_prime));
	mu[1]=1;
	is_prime[1]=false;
	p_cnt=0;
	for (ll i=2; i<MAXN; ++i) {
		if (is_prime[i]) {
			prime[p_cnt++] = i;
			mu[i]=-1;
		}
		for (ll j=0; j<p_cnt&&prime[j]*i<MAXN; ++j) {
			is_prime[prime[j]*i]=false;
			if (i%prime[j]==0) {
				mu[i*prime[j]]=0;
				break;
			}
			else {
				mu[i*prime[j]]=-mu[i];
			}
		}
	}
}
int main() {
//	freopen("in.txt","r",stdin);
//    freopen("out1.txt","w",stdout);
	Mubi();
	ll n;
	ll p,d;
	while (cin>>n) {	
		ll res=0;
		for (ll i=0; i<p_cnt&&prime[i]<=n; ++i) {
			p=prime[i];
			for (ll j=1; j*p<=n; ++j) {
				d=p*j;
				res+=mu[j]*(n/d)*(n/d);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}
